Ext.namespace("Task.Remind");

Task.Remind.panel = function() {
	this.renderReminWay = function(s, m, rec){
		var remindWay = rec.get("CC_REMIND");
		//alert(remindWay);
		if(remindWay==1){
			return "短信";
		}else if(remindWay==2){
			return "邮件";
		}else if(remindWay==3){
			return "短信 | 邮件";
		}else{
			return "无";
		}
	};
	this.exeId;
	this.store = new Ext.data.Store({
		proxy: new Ext.data.HttpProxy({
			url: '../task/searchTaskRemind.form?timesnap=' +new Date().getTime()
		}),
		reader: new Ext.data.JsonReader({
			root: 'result',
			totalProperty: 'total',
			fields: ['ID','CC_USER','CC_TIME', 'CC_CONTENT', 'CC_REMIND','USER_NAME','RE_ID']
		}),listeners:{
			 beforeload :{    
	    	  	fn : function(thiz,options){
       	          Ext.apply(thiz.baseParams,
       	          { 
       	          	taskId:this.exeId
       	          });    
              },
              scope:this 
	    	}
		}
	});
	this.colModel = new Ext.grid.ColumnModel({
	    defaults: {
	        width: 100,
	        sortable: true,
	        align: 'center'
	    },
	    columns: [
			{header: 'ID', width: 50, hidden: true, dataIndex: 'ID'},
			{header: '执行人', width: 80, dataIndex: 'USER_NAME'},
			{header: '催办时间', width: 80, dataIndex: 'CC_TIME'},
			{header: '内容',width: 200, dataIndex: 'CC_CONTENT'},
			{header: '方式',width: 200, dataIndex: 'CC_REMIND',renderer:this.renderReminWay}
		]
	});
	
	this.gridPanel = new Ext.grid.GridPanel({
		region: 'center',
		cm:this.colModel,
		store:this.store,
		stripeRows: true, 
		sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
        loadMask: {msg: '加载中，请稍候...'},
        bbar:new Ext.PagingToolbar({
			 pageSize: 10,
	         store: this.store,
	         displayInfo: true,
	         displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
	         emptyMsg: "没有记录..."
		}),
        viewConfig: { forceFit: true }
	});
	Task.Remind.panel.superclass.constructor.call(this, {
		title:'催办情况',
		layout:'border',
		items:[this.gridPanel],
		listeners:{
			render:this.queryUpfile,
			activate:this.queryUpfile
		}
	});
};
Ext.extend(Task.Remind.panel, Ext.Panel, {
	initFeedBack:function(exeId){
		this.exeId = exeId;
	},
	queryUpfile :function(exeId){
		this.store.load({
			params:{
				start : 0,
				limit : 10,
				taskId:this.exeId
			}
		});
	}
});


